<?php
require_once '../include/common.inc.php';
$table="cus_members";

$sql = "select * FROM  promoter_info order by id desc ";
$query = $db->query($sql);
while($rs=$db->fetch_array($query))
{
	$r[]=$rs;
}



header("Content-type:application/vnd.ms-excel");  
header("Content-Disposition:filename=Promoter_Info_" . date("Ymd") . ".xls");  

echo "Promoter ID \t";
echo "First Name \t";
echo "Last Name \t";
echo "Status \t";
echo "Sign up Date \t";
echo "Website \t";
echo "Street \t";
echo "City \t";
echo "State \t";
echo "Zip \t";
echo "Country \t";
echo "Phone \t";
echo "Mobile \t";
echo "Fax \t";
echo "Email \t";
echo "Rank \t";
echo "Delivery Address \t";
echo "Delivery Street \t";
echo "Delivery City \t";
echo "Delivery State \t";
echo "Delivery Zip \t";
echo "Delivery Country \t\n";



for ($i=0;$i<count($r);$i++){

//Status
if($r[$i]['status']==0) $status="Non-Approve";

if($r[$i]['status']==1) $status="Approved";
						  
if($r[$i]['status']==2) $status="Disapproved";
						  
//Rank
$rank=$RANK_ARY[$rs['rank']];	



echo replaceHtmlAndJs($r[$i]['id']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['firstname']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['lastname']  ). "\t"; 
echo replaceHtmlAndJs($status  ). "\t"; 
echo replaceHtmlAndJs(date($r[$i]['date'])  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['website']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['street']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['city']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['state']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['zip']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['country']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['phone']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['mobile']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['fax']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['email']  ). "\t";
echo replaceHtmlAndJs($rank  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['street2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['city2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['state2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['zip2']  ). "\t"; 
echo replaceHtmlAndJs($r[$i]['country2']  ). "\t";
echo "\n"; 

}



?>


